<form method="POST" class="remote-form">
    <b>Billing collection method</b><br />
    {{ csrf_input }}
    <input type="hidden" name="{{ remote_type }}" value="{{ remote_id }}" />
    <select name="billing_modality" class="billing-modality-select" required>
        <option value="charge_automatically" {% if current_plan.charge_automatically %}selected{% endif %}>Charge automatically</option>
        <option value="send_invoice" {% if not current_plan.charge_automatically %}selected{% endif %}>Pay by invoice</option>
    </select>
    <button type="submit" class="btn btn-default support-submit-button">Update</button>
</form>

{% if current_plan.end_date and current_plan.status == current_plan.ACTIVE %}
<form method="POST" class="remote-form">
    <b>Plan end date</b><br />
    {{ csrf_input }}
    <input type="hidden" name="{{ remote_type }}" value="{{ remote_id }}" />
    <input type="date" name="plan_end_date" value="{{ current_plan.end_date.strftime('%Y-%m-%d') }}" required />
    <button type="submit" class="btn btn-default support-submit-button">Update</button>
</form>
{% endif %}

<form method="POST" class="remote-form">
    <b>Modify current plan</b><br />
    {{ csrf_input }}
    <input type="hidden" name="{{ remote_type }}" value="{{ remote_id }}" />
    <select name="modify_plan" class="modify-plan-method-select" required>
        <option disabled value="" selected>-- select --</option>
        <option value="downgrade_at_billing_cycle_end">Downgrade at the end of current billing cycle</option>
        <option value="downgrade_now_without_additional_licenses">Downgrade now without creating additional invoices</option>
        <option value="downgrade_now_void_open_invoices">Downgrade now and void open invoices</option>
    </select>
    <button type="submit" class="btn btn-default support-submit-button">Modify</button>
</form>
